package com.smalldoor.thread.staticProxyDemo;

// 模拟静态代理方法 主类完成自身功能，代理类完成主类无法完成的功能
public interface StaticMarry {

    public static void main(String[] args) {
        WeddingCompany weddingCompany = new WeddingCompany(new OnePeople());
        weddingCompany.HappyMarry();
    }
}

interface Marry{
    void HappyMarry();
}

class OnePeople implements Marry {

    @Override
    public void HappyMarry() {
        System.out.println("这是onePeople类在执行方法");
    }
}

class WeddingCompany implements Marry {

    private Marry target;

    public WeddingCompany(Marry target) {
        this.target = target;
    }

    @Override
    public void HappyMarry() {
        before();
        this.target.HappyMarry();
        after();
    }
    private void before() {
        System.out.println("婚前策划");
    }
    private void after() {
        System.out.println("婚后收尾款");
    }


}